package com.example.demo.controller;/**
 * ClassName: TimeSlotAvailabilityController
 * Package: com.example.demo.controller
 * Description:
 *
 * @Author 理理
 * @Create 2025/3/2 18:25
 * @Version 1.0
 */

import com.example.demo.entity.TimeSlotAvailability;
import com.example.demo.service.TimeSlotAvailabilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.sql.Date;
import java.util.List;

/**
 *
 *@title: TimeSlotAvailabilityController
 *@Author: Tangerine
 *@Date: 2025/3/2 18:25
 *@version 1.0
 */
@RestController
@RequestMapping("/time")
public class TimeSlotAvailabilityController {

    @Autowired
    private TimeSlotAvailabilityService timeSlotAvailabilityService;

    //查询已确认的预约数量（即预约成功）
    @GetMapping("/confirm")
    public List<TimeSlotAvailability> confirm(@RequestParam String name, @RequestParam Date start_date, @RequestParam Date end_date){
        return timeSlotAvailabilityService.confirm(name,start_date,end_date);
    }

    @GetMapping("/con")
    public TimeSlotAvailability con(@RequestParam String name, @RequestParam Date date, @RequestParam int time){
        return timeSlotAvailabilityService.con(name,date,time);
    }
}
